package cn.xaut.XAUT迎春杯预热;

import java.util.LinkedList;
import java.util.Queue;
import java.util.Scanner;

/**
 * E - 操作队列
 */
public class demoE {

    public static void main(String[] args) {

        Scanner input = new Scanner(System.in);
        int n = input.nextInt();
        Queue<Integer> queue = new LinkedList<>();
        for (int i = 0; i < n; i++) {
            int m = input.nextInt();
            if (m == 1) {
                queue.offer(input.nextInt());   // 入队操作
            } else if (m == 2) {
                Object element = queue.poll();  // 出队操作
                if (element != null)
                    System.out.println(element);
                else    // element == null
                    System.out.println("empty");
            }
        }
    }
}
